#ifndef _INCLUDE_LOG_H
#define _INCLUDE_LOG_H

/********************LOG Configuration START********************/

#define LOOPSYS_ENABLE_LOG
#define LOG_BUF_SIZE  64

/********************LOG Configuration END********************/

enum{
    LOG_LV_S = 0,
    LOG_LV_E,
    LOG_LV_W,
    LOG_LV_I,
    LOG_LV_D,
    LOG_LV_NUM,
};

#ifdef LOOPSYS_ENABLE_LOG

#include <stdint.h>

#define LOG(lv, tag, format, ...)  log_print(lv, tag, format, ##__VA_ARGS__)
#define LOGS(format, ...) LOG(LOG_LV_S,     0, format, ##__VA_ARGS__)
#define LOGE(format, ...) LOG(LOG_LV_E, "[E]", format, ##__VA_ARGS__)
#define LOGW(format, ...) LOG(LOG_LV_W, "[W]", format, ##__VA_ARGS__)
#define LOGI(format, ...) LOG(LOG_LV_I, "[I]", format, ##__VA_ARGS__)
#define LOGD(format, ...) LOG(LOG_LV_D, "[D]", format, ##__VA_ARGS__)

#define LOGS_EN(en) log_enable(LOG_LV_S, en)
#define LOGE_EN(en) log_enable(LOG_LV_E, en)
#define LOGW_EN(en) log_enable(LOG_LV_W, en)
#define LOGI_EN(en) log_enable(LOG_LV_I, en)
#define LOGD_EN(en) log_enable(LOG_LV_D, en)

void log_print(uint8_t lv, char *tag, const char* format, ...);
void log_enable(uint8_t lv, uint8_t en);

#else

#define LOG(lv, tag, format, ...)
#define LOGS(format, ...)
#define LOGE(format, ...)
#define LOGW(format, ...)
#define LOGI(format, ...)
#define LOGD(format, ...)

#define LOGS_EN(en)
#define LOGE_EN(en)
#define LOGW_EN(en)
#define LOGI_EN(en)
#define LOGD_EN(en)

#endif//LOOPSYS_ENABLE_LOG


#endif//_INCLUDE_LOG_H
